#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QDebug>
#include <QDesktopWidget>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->move(10,0);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    ui->webView->load(QUrl("http://www.deskcine.com/nerddigital"));
}

void MainWindow::on_pushButton_2_clicked()
{
    // get the dimension available on this screen
        QSize availableSize = qApp->desktop()->availableGeometry().size();
        int width  = availableSize.width();
        int height = availableSize.height();
        qDebug() << "Available dimensions " << width << "x" << height;
        //width  *= 0.9;   // 90% of the screen size
        height = 20;  // 90% of the screen size
        qDebug() << "Computed dimensions " << width << "x" << height;
        QSize newSize( width, height );

        setGeometry(
                    QStyle::alignedRect( Qt::LeftToRight,
                                         Qt::AlignCenter,
                                         newSize,
                                         qApp->desktop()->availableGeometry() )
                    );
}
